package src
{
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.events.KeyboardEvent;
	import flash.ui.Keyboard;
	
	public class Game extends MovieClip
	{
		private var t:uint;
		
		public function Game()
		{
			addEventListener(Event.ENTER_FRAME, onEnterFrame);
		}
		public function onKeyPressed(e:KeyboardEvent):void{
			trace('hola');
			switch(e.keyCode){
				case Keyboard.LEFT: player.x -= player.speed; break;
				case Keyboard.RIGHT: player.x += player.speed; break;
			}
		}
		private function onEnterFrame(e:Event):void{
			t++;
			spawner.update();
			if ( t == 50){
				t = 0;
				spawner.spawn();
			}
		}
	}
}